<?php
session_start();

define('DIR_SEP', '/');
define('APPROOT', realpath(dirname(__file__) . DIRECTORY_SEPARATOR . '..') . DIRECTORY_SEPARATOR);

require './MainClass.php';
require '../libs/Framework/Lang.php';

error_reporting(0);

$buttons_left = "";
$buttons_right = "";
@$_GET['p'] = (intval($_GET['p']) == 0) ? 1 : $_GET['p'];

class Hash
{
    public $username;
    public $password;
    public $salt;
    
    public $secret_key = '0faf8786effe68580caedb7c3aeb73dd';

    public function __construct($username, $password)
    {
        $this->username = $username;
        $this->password = $password;
    }

    final public function hash()
    {
        $password = hash_hmac('ripemd160', $this->password, $this->secret_key);
        $salt = sha1(md5($this->username . mktime()));

        $this->password = $password;
        $this->salt = $salt;

    }


}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">

<head>
<title>VisionCMS - <?php echo Lang::getInstall('title'); ?></title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<link href="style.css" rel="stylesheet" type="text/css" />
<script src="./mootools.js" type="text/javascript"></script>

<script type="text/javascript">

function status(sb_start,sb_end,seconds)
{
	var speed = Math.round(seconds*10);
	var timer = 0;
	for(i = sb_start; i <= sb_end; i++)
	{
		setTimeout("process('" + i + "')",(timer*speed));
		timer++;
	}
}

function process(status)
{
	var progress = document.getElementById('status');
	progress.innerHTML = status + '%';

	var bar = document.getElementById('bar');
	bar.style.width = status + '%';

	if(status == 100) progress.innerHTML = '<?php echo Lang::getInstall('bar_done'); ?>';
}

window.addEvent('domready', function(){

$('cancel').addEvent('click', function(){
    var r=confirm("<?php echo Lang::getInstall('exit'); ?>");
	if (r==true)
  	{
  	window.close();
  	}else{
  		return false;
  	}
});

<?php if(intval($_GET['p']) == 7){ ?>
$('close-button').addEvent('click', function(){
	window.close();
	});

$('start-button').addEvent('click', function(){
	window.location.href="<?php echo $_SESSION['urlPath'] ?>";
	});
<?php } ?>

<?php if(intval($_GET['p']) == 2){ ?>
$('disagree').addEvent('click', function(){
    alert('<?php echo Lang::getInstall('licence'); ?>');
    return false;
});

$('agree').addEvent('click', function(){
    window.location.href="index.php?p=<?php echo intval($_GET['p'])+1 ?>";
});
<?php } ?>

}); 
</script>
</head>

<body>
<div id="wrapper">


<div id="masthead">
</div>

<div id="top_nav">
</div>
<?php
if(intval($_GET['p']) != 7){
?>
<form action="index.php?p=<?php echo intval($_GET['p'])+1; ?>" method="post" style="padding:0; margin:0;" id="MainForm">
<?php
}
?>
<div id="right">

<?php

/**
 * @author Martin Pernica
 * @copyright 2009
 */

if(empty($_GET['p'])){
	require 'step1.php';
}else{
	require 'step'.intval($_GET['p']).'.php';
}

?>
</div>

<div id="left">

<ul id="steps">
<?php
echo $menu;
?>
</ul>

</div>


<div id="clean"></div>
<div id="footer">
<div id="left_buttons">
<?php
echo $buttons_left;
?>
</div>
<div id="right_buttons">
<?php
echo $buttons_right;
?>
</div>
<?php
if(intval($_GET['p']) != 7){
?>
</form>
<?php
}
?>
</div>

</div>

</body>

</html>
